package com.sloera.nowcoder;

import java.util.regex.Pattern;

/**
 * class com.sloera.nowcoder
 * user sloera
 * date 2022/2/22
 */
public class HJ90 {
    public static void main(String[] args) {
        // Scanner in = new Scanner(System.in);
        // final String s = in.nextLine();
        String source = "01.2.3.8";
        // String source = "255.255.255.255";
        isValid(source);
    }

    private static void isValid(String source) {
        final boolean b = Pattern.compile("^((2[0-4]\\d|25[0-5]|[0-1]?\\d?\\d)\\.){3}(2[0-4]\\d|25[0-5]|[0-1]?\\d?\\d)$").matcher(source).find();
        final boolean c = Pattern.compile("\\.0\\d|^0\\d").matcher(source).find();
        System.out.println(b && !c ? "YES" : "NO");
    }
}
